package chp11;

import java.util.Scanner;

public class Game1 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("请出拳:1.剪刀 2.石头 3.布(输入相应数字):");
        int myFist = input.nextInt();
        switch (myFist){
            case 1:
                System.out.println("你出拳:剪刀");break;
            case 2:
                System.out.println("你出拳:石头");break;
            case 3:
                System.out.println("你出拳:布");break;
        }
        int compFist = (int) (Math.random()*3+1);
        switch (compFist){
            case 1:
                System.out.println("电脑出拳:剪刀");break;
            case 2:
                System.out.println("电脑出拳:石头");break;
            case 3:
                System.out.println("电脑出拳:布");break;
        }

        //比较胜负
        if(myFist == compFist){
            System.out.println("结果：平手");
        }else if(myFist==1&&compFist==3 || myFist==2&&compFist==1 || myFist==3&&compFist==2){
            System.out.println("结果：你赢了");
        }else{
            System.out.println("结果：你输了");
        }
    }
}
